#!/bin/sh

set -e

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

#DEBHELPER#

case "$1" in
    upgrade)
	# save old configuration
	test -d /etc/shellinabox/options-enabled || exit 0
	ls /etc/shellinabox/options-enabled/*.css > /dev/null 2>&1 || exit 0
	if dpkg --compare-versions "$2" le "2.14-1"; then
		mkdir -p /etc/shellinabox/options-enabled-save
		cp -a /etc/shellinabox/options-enabled/*.css /etc/shellinabox/options-enabled-save
	fi
    ;;

    install|abort-upgrade)
    ;;

    *)
        echo "preinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac
